﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    public class RecordStatus : global::Xtee.Core.Schema.XsdString {
        
        public const string K = "K";
        
        public const string A = "A";
        
        public const string O = "O";
        
        public const string V = "V";
        
        public const string S = "S";
        
        public RecordStatus(string value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (Value == "K") {
                annot = "K";
            }
            if (Value == "A") {
                annot = "A";
            }
            if (Value == "O") {
                annot = "O";
            }
            if (Value == "V") {
                annot = "V";
            }
            if (Value == "S") {
                annot = "S";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public RecordStatus() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.RecordStatus result) {
            try {
                result = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.RecordStatus(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (RecordStatus value) {
            return value.Value;
        }
        
        public static implicit operator RecordStatus (string value) {
            if (value==null) {
                return null;
            }
            return new RecordStatus(value);
        }
    }
}
